<!--
*  功能描述：绩效管理：部门内考核
 -->
   <template>
  <div>
    <div>
      <el-descriptions title="部门内考核" :column="2" border>
      </el-descriptions>
    </div>
    <el-table :data="tableData" style="width: 100%">
      <el-table-column prop="DepId" label="序号">
      </el-table-column>
      <el-table-column prop="DepName" label="部门名称">
      </el-table-column>
      <el-table-column label="是否参与">
        是
      </el-table-column>
      <el-table-column label="考核人员">
        <template slot-scope="scope">
          <button @click="PeoPle(scope.row.DepId)">人员设置</button>
        </template>
      </el-table-column>
      <el-table-column prop="DepHide" label="考核状态">
        <template slot-scope="scope">
          <span v-if="scope.row.DepHide" class="a">已提交考核</span>
          <span v-else class="b">未提交</span>
        </template>
      </el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
          <button @click="tijiao(scope.row.DepId)">提交考核</button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

  <script>
export default {
  data () {
    return {
      tableData: [],
    }
  },
  methods: {
    show () {
      this.$http({
        url: 'AssDep/GetDepartment',
        method: 'get',
      })
        .then(res => {
          this.tableData = res.data
        })
    },
    tijiao (id) {
      if (confirm('确定提交考核状态吗')) {
        this.$http({
          url: 'AssDep/PutDepartment',
          method: 'put',
          params: {
            id: id
          }
        })
          .then(res => {
            if (res.data == 0) {
              this.$message.success('提交状态成功');
              this.show();
            }
          })
      }

    },
    PeoPle (id) {
      this.$router.push({
        path: '/AssPeo',
        name: 'AssPeo',
        params: {
          id: id
        }
      })
    }
  },
  created () {
    this.show();
  }
}
  </script>
  <style scoped>
.a {
  background-color: rgb(25, 240, 50);
  color: aliceblue;
  border-radius: 100px;
  padding: 10px;
}
.b {
  background-color: red;
  color: aliceblue;
  border-radius: 100px;
  padding: 10px;
}
</style>